
export class ResultBean {
    readonly code: string;
    data?: any;
    msg?: string;

    private constructor(code: string, data?: any, msg?: string) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public static success(data: any): ResultBean {
        return new ResultBean("200", data, null);
    }
    public static successMsg(msg: string): ResultBean {
        return new ResultBean("200", null, msg);
    }

    public static error(msg: string, code: string = "500"): ResultBean {
        return new ResultBean(code, null, msg);
    }

    public static builder(setting:ResultBean):ResultBean{
        return new ResultBean(setting.code,setting.data,setting.msg);
    }

}
